package adv410;

import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class XMLEnc {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        list.add(new Student("王二", "34343", "138983", 22, "男", "java"));
        list.add(new Student("王4", "222324", "138983", 22, "男", "java"));
        list.add(new Student("王3", "666", "138983", 22, "男", "java"));
        list.add(new Student("王5", "6663434", "138983", 22, "男", "java"));

        try {
            XMLEncoder xe=new XMLEncoder(new FileOutputStream("stus.xml"));

            xe.writeObject(list);
            xe.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
